package root.electronclass.electronclass.common.util;


import root.electronclass.electronclass.R;

import java.util.ArrayList;
import java.util.List;

public class HeadUtil {

    private static List<Integer> pic1 = new ArrayList<Integer>(){{
        add(R.mipmap.g_teacher1);
        add(R.mipmap.g_teacher2);
        add(R.mipmap.g_teacher3);
    }};
    private static List<Integer> pic2 = new ArrayList<Integer>(){{
        add(R.mipmap.b_teacher1);
        add(R.mipmap.b_teacher2);
        add(R.mipmap.b_teacher3);
    }};
    private static List<Integer> pic3 = new ArrayList<Integer>(){{
        add(R.mipmap.g_student1);
        add(R.mipmap.g_student2);
        add(R.mipmap.g_student3);
    }};
    private static List<Integer> pic4 = new ArrayList<Integer>(){{
        add(R.mipmap.b_student1);
        add(R.mipmap.b_student2);
    }};

    /**
     *
     * @param type 0女教师 1男教师 2女学生 3男学生
     * @return
     */
    public static int getHeadPic(int type){
        switch (type){
            case 0:
                return pic1.get((int) (Math.random() * (pic1.size()-1)));
            case 1:
                return pic2.get((int) (Math.random() * (pic2.size()-1)));
            case 2:
                return pic3.get((int) (Math.random() * (pic3.size()-1)));
            case 3:
                return pic4.get((int) (Math.random() * (pic4.size()-1)));
        }
        return 0;
    }
}
